package de.westranger.forex.code.script;

import java.io.IOException;
import java.text.ParseException;

import de.westranger.forex.trading.genetic.CSVBasedContentResolver;
import de.westranger.forex.trading.genetic.ContentResolver;
import de.westranger.forex.trading.genetic.allel.operator.TerminalSymbol;

public class MQLIndicator {

	
	public static double Bid;
	public static double Ask;
	private static ContentResolver conRes;
	private static int conResTime;

	public static double[] High = null;
	public static double[] Low = null;
	public static long[] Time = null;
	
	public static void init(final String path){
		High = new double[30];
		Low = new double[30];
		Time = new long[30];
		conResTime = -1;
		try {
			conRes = new CSVBasedContentResolver(path);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}

	public static boolean next(){
		if(conResTime < conRes.getValueCount()-1){
			conResTime++;
			
			High[0] = conRes.resolve(TerminalSymbol.HIGH.getValue(), conResTime);
			Low[0] = conRes.resolve(TerminalSymbol.LOW.getValue(), conResTime);
			Time[0] = (long)conRes.resolve(TerminalSymbol.TIME.getValue(), conResTime);

			// bid ist kleiner als ask
			Bid = Low[0];
			Ask = High[0];
			
			return true;
		}else{
			return false;
		}
	}

	public static boolean OrderSelect(int ticket, int sELECT_BY_TICKET) {
		// TODO Auto-generated method stub
		return false;
	}

	public static Object OrderTicket() {
		// TODO Auto-generated method stub
		return null;
	}

	public static Object Symbol() {
		// TODO Auto-generated method stub
		return null;
	}

	public static int OrdersTotal() {
		// TODO Auto-generated method stub
		return 0;
	}

	public static Object OrderLots() {
		// TODO Auto-generated method stub
		return null;
	}

	public static double AccountBalance() {
		// TODO Auto-generated method stub
		return 0;
	}

	public static void OrderClose(Object orderTicket, Object orderLots,
			Object bid, int i, int green) {
		// TODO Auto-generated method stub
		
	}

	public static double NormalizeDouble(double x, int i) {
		return 0.0;
	}

	public static int OrderSend(Object symbol, int oP_BUY, double invest,
			Object normalizeDouble, int i, double d, double e, String string,
			int j, int k, int green) {
		// TODO Auto-generated method stub
		return 0;
	}
}
